package com.starblink.feedback.ui

import android.app.Activity
import android.view.View
import androidx.fragment.app.FragmentManager
import com.starblink.android.basic.ext.click
import com.starblink.android.basic.widget.dialog.BaseBottomSheetFragment
import com.starblink.feedback.databinding.MoreDialogLayoutBinding
import com.starblink.rocketreserver.fragment.PostD

class PostMoreDialog(
    val context: Activity,
    private val supportFragmentManager: FragmentManager,
    val post: PostD,
) : BaseBottomSheetFragment() {
    lateinit var mBinding: MoreDialogLayoutBinding
    override fun getBindingRootView(): View {
        mBinding = MoreDialogLayoutBinding.inflate(layoutInflater)
        return mBinding.root
    }

    override fun initView() {
        mBinding.close.click {
            dismiss()
        }

        mBinding.report.click {
            ReportPostDialog(
                contxt = context,
                targetId =  post.id,
                reportType =  if (post.contentType == "2") 2 else 1,
                content = post.content ?: "",
                picUrl = post.mainPic,
                videoUrl =  if (post.contentType == "2") (post.pictures?.get(0)?.pictureF?.picUrl ?: "") else "",
            ).show(supportFragmentManager, "report")
            dismiss()
        }

        mBinding.feedback.click {
            val inputTextMsgDialog =
                PostFeedbackDialog(context, com.starblink.android.basic.R.style.dialog_center)
            inputTextMsgDialog.setTextSendListener {
            }
            inputTextMsgDialog.setId(post.id)
            inputTextMsgDialog.show()
//            FeedbackPostDialog(context,post.id).show(supportFragmentManager, "feedback")
            dismiss()
        }
    }

}